package com.dayou.common.core.page;

import com.dayou.common.constant.Constants;
import com.dayou.common.utils.ServletUtils;
import com.dayou.common.utils.StringUtils;

import java.io.IOException;

/**
 * 表格数据处理
 * 
 * @author dayou
 */
public class TableSupport
{
    /**
     * 封装分页对象
     */
    public static PageDomain getPageDomain(){
        PageDomain pageDomain = new PageDomain();
        Integer pageNum = ServletUtils.getParameterToInt(Constants.PAGE_NUM);
        Integer pageSize = ServletUtils.getParameterToInt(Constants.PAGE_SIZE);
        String orderByColumn = ServletUtils.getParameter(Constants.ORDER_BY_COLUMN);
        String isAsc = ServletUtils.getParameter(Constants.IS_ASC);
        pageDomain.setPageNum(pageNum);
        pageDomain.setPageSize(pageSize);
        pageDomain.setOrderByColumn(orderByColumn);
        pageDomain.setIsAsc(isAsc);
        return pageDomain;
    }

    public static PageDomain buildPageRequest(){
        return getPageDomain();
    }
}
